package com.qingcheng.dao;

import com.qingcheng.pojo.system.Admin;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface AdminMapper extends Mapper<Admin> {
    @Select("SELECT * FROM tb_admin_role ar\n" +
            "INNER JOIN  tb_admin a\n" +
            "ON ar.`admin_id`=a.id\n" +
            "INNER JOIN tb_role r\n" +
            "ON ar.`role_id`=r.`id`\n" +
            "INNER JOIN tb_role_resource rr\n" +
            "ON rr.`role_id`=r.`id`\n" +
            "INNER JOIN tb_resource tr\n" +
            "ON rr.`resource_id`=tr.`id`\n" +
            "WHERE a.status=1\n" +
            "AND   a.`delete_id`=1\n" +
            "AND a.`login_name`=#{loginName}")
    List<Map>selectByusername(@Param("loginName")String username);

}
